<template>
	<view>
		<!-- 若需显示自定义导航栏，需要在App.vue中引入Vue -->
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<block slot="content">商品评价</block>
		</cu-custom>
		<scroll-view scroll-y="true" >
			<view>
				<view class="pageContent">
					<view class="label">
						<text class="cuIcon-comment" style="margin-right: 10upx;"></text>
						全部评价
					</view>
					
					<view class="commentItems" v-for="evaluation in evaluationList">
						<view class="commentHead">
							<view>
								<text style="margin-right: 20upx;">{{evaluation.evaluationUserOpenid.slice(0,1)}}***{{evaluation.evaluationUserOpenid.slice(5,6)}}</text>
								<text v-for="count in parseInt(evaluation.evaluationStar)" class="cuIcon-favorfill text-orange"></text>
							</view>
							<view style="color: #555555;">
								{{evaluation.evaluationTime.year + 1900}}-{{evaluation.evaluationTime.month + 1}}-{{evaluation.evaluationTime.date}}
							</view>
						</view>
						<view class="commentInfo" style="color: #555555; padding-top: 10upx; padding-left: 15upx;">
							{{evaluation.evaluationContent}}
						</view>
						
						<view class="commentFeedBack" v-if="evaluation.evaluationFeedback != ''">
							<view class="feedbackLabel">客服回复：</view>
							<view class="feedbackContent">{{evaluation.evaluationFeedback}}</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import { getEvaluationByGoodsId } from '../../api/evaluationAPI.js'
	export default {
		data() {
			return {
				evaluationList: [
					{
						"evaluationUserOpenid": "o6E-Q4qEtfpEEkq1lWCwmtZ7YzpY",
						"evaluationStar": 5,
						"evaluationTime": {
							"date": 18,
							"hours": 15,
							"seconds": 38,
							"month": 10,
							"timezoneOffset": -480,
							"year": 119,
							"minutes": 47,
							"time": 1574063258000,
							"day": 1
						},
						"evaluationFeedback": "好的，谢谢评价",
						"evaluationHomestayId": "",
						"evaluationId": 39,
						"evaluationType": "1",
						"evaluationGoodsId": "FA0257",
						"evaluationFeedbackTime": null,
						"evaluationUserId": "",
						"evaluationHasfeedback": "",
						"evaluationOrderId": "H20190530182523094",
						"evaluationContent": "香菇收到了，吃后感觉很有弹性，特别好吃！",
						"evaluationImg": "",
						"evaluationStatus": "1"
					}
				]
			}
		},
		methods: {
			
		},
		onLoad(params) {
			let goodsId = params.id;
			if(null == goodsId) {
				goodsId = 'FA0257'
			}
			getEvaluationByGoodsId(goodsId).then((resp) => {
				this.evaluationList = resp
				console.log("resp: ",resp);
			})
		}
	}
</script>

<style>
	@import url("./evaluationList.css");
</style>
